package stud.mpgame.flash.test;
import stud.mpgame.network.Message;
import stud.mpgame.network.UserObject;
import stud.mpgame.snapshot.ICommand;
import flash.utils.IDataOutput;
import stud.mpgame.snapshot.ISnapshot;

/**
 * ...
 * @author pavel
 */

class TestCommand extends UserObject, implements ICommand {
	
	private var value:Int;
	
	public function new(value:Int) {
		super();
		this.value = value;
	}
	
	public override function writeExternal(output:IDataOutput, message:Message):Void {
        output.writeInt(value);
    }
	
	public function getTime():Int {
		return 1;
	}
	
	public function apply(snapshot:ISnapshot):Void {
		cast(snapshot, TestSnapshot).setValue(value);
	}
	
}